import localforage from 'localforage'

 let signInUser = {
   userId: 'AA516BC2-F101-48B9-B393-4C7B254E904C',
   isBlank: 0,
   blankTime: '2017-6-27 10:11:20'
 }

/*let signInUser = {
  userId: null,
  isBlank: 0,
  blankTime: ''
}*/

let userInfo = () => {
  if (signInUser.userId) return signInUser
  localforage.getItem('userInfo', (err, userInfo) => {
    if (!err && userInfo) {
      signInUser = userInfo
    }
  })
  return signInUser
}

let saveUserInfo = userInfo => {
  signInUser = userInfo
  return signInUser
}

module.exports = {
  userInfo,
  saveUserInfo
}
